<template>
	<view>
		<button size="default" type="default" 
			style="color:#ffffff;backgroundColor:#1AAD19;borderColor:#1AAD19" 
			hover-class="is-hover" @click="openCanvar">按钮</button>
		<cm-painter :ewmImg="ewmImg" :avator="userAvator" :userName="userName" @painterSucc="painterSucc"
			 @cancelCanvas="showCanvas = false" v-if="showCanvas"></cm-painter>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showCanvas: false,
				ewmImg: 'https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg',
				userAvator: 'https://m.360buyimg.com/babel/jfs/t1/196317/32/13733/288158/60f4ea39E6fb378ed/d69205b1a8ed3c97.jpg',
				userName: '爱你',
				imgsPath: ''
			};
		},
		methods: {
			painterSucc(el) {
				this.imgsPath = el
			},
			openCanvar() {
				var _this = this
				// this.$api.sendRequest({
				// 	url: '/api/diyview/infos',
				// 	data: {
						
				// 	},
				// 	success: res => {
				// 		if (res.code == 0 && res.data) {
				// 			_this.showCanvas = true
				// 		}
				// 	}
				// });
				setTimeout(()=>{
					_this.showCanvas = true
				},500)
			},
		}
	}
</script>

<style lang="scss">

</style>
